//判断:当前元素是否是被筛选元素的子元素
$.fn.isChildOf = function(b){
	return (this.parents(b).length > 0);
};
//判断:当前元素是否是被筛选元素的子元素或者本身
$.fn.isChildAndSelfOf = function(b){
	return (this.closest(b).length > 0);
};

/*弹出层*/
$.fn.showBox = function( options ){ 
    var o = $.extend({ 
    		id:"showBox",
            nav:"",
			headClass:"",
			content:"",
			style:null
		}, options);
	
	var t = this;
	
	var a = {
			init:function(){

			}
			
	}
	
	a.init();
}


/*弹出盒子 */
$.fn.box = function( options ){ 
    var o = $.extend({ 
    		id:"showBox",
            width:400,
			height:"",
			top:"",
			left:"",
			headerHtml:"",
			buttonHtml:"",
			contentHtml:"",
			hasClose:true,
			hasBg:true,
			clickOther:true,
			bindEvent:function(c){}
		}, options);
	
	var t = this;
	var c=options.bindEvent;
	
	o.bindEvent=function(){
		c(a.anmiClose);
	}
	
	var a = {
			init:function(){
				if($("#"+o.id).length !== 0){
					$("#"+o.id).remove();
				}
				this._createBox();
				this.setBox();
				
				
				this._bindEvent();
				
			},
			
			_createBox:function(){
				var html="<div id='"+o.id+"' class='Box'>" +
							"<div class='BoxBg'></div>"+
							"<div class='BoxContent'>" +
							"<table width='100%'  border='0' cellspacing='0' cellpadding='0'>"+
							  "<tr>"+
							    "<td class='box_1 icon'></td>"+
							    "<td class='box_2'></td>"+
							    "<td class='box_1 icon box_right'></td>"+
							  "</tr>"+
							  "<tr>"+
							    "<td class='box_4'></td>"+
							    "<td class='box_5 '>" +
							    	"<div class='box-content'>"+
								   		"<div class='box-head'></div>"+
										"<section>"+o.contentHtml+"</section>"+
										"<div class='box-foot'></div>"+
									"</div>"+
								"</td>"+
							    "<td class='box_4 box_right'></td>"+
							  "</tr>"+
							  "<tr>"+
							    "<td class='box_7 icon'></td>"+
							    "<td class='box_8'></td>"+
							    "<td class='box_7 box_right icon'></td>"+
							  "</tr>"+
							"</table>"+
							"<span class='BoxClose icon'></span>"+
							"</div>"+
						"</div>";
				$("#scene").append(html);
				this.id = $("#"+o.id);
				
				
				
			},
			
			setBox:function(){
				var content = $(".BoxContent");
				var section = content.find("section");
				var header = content.find(".box-head");
				var footer = content.find(".box-foot");
				
				
				if(o.headerHtml){
					header.html(o.headerHtml)
				}else{
					header.hide();
				}
				
				if(o.buttonHtml){
					footer.html(o.buttonHtml)
				}else{
					footer.hide();
				}
				
				if(!o.hasBg){
					$(".BoxBg").hide();
				}
				
				if(!o.hasClose){
					$(".BoxClose").hide();
				}
				
				content.css({
					"width":o.width,
					"left":"50%",
					"margin-left":-o.width/2,
					"top":"50%",
					"margin-top":-parseInt(content.css("height"))/2
				});
				
				var _t =this;
				setTimeout(function(){
					_t.animShow();
				},100)
			},
			
			
			animShow:function(){
    			var _t = this;
    			var content = $(".BoxContent");
    			
    			content.css({
    				 "-webkit-transform":"scale(0,0)",
    				 "opacity":0
  				});
    			
    		
    			
    			content.animate({
    				"-webkit-transform":"scale(1.1,1.1)",
    				"opacity":1
    			},300,"ease-in-out");
    			
    			setTimeout(function(){
    				content.animate({
        				"-webkit-transform":"scale(1.0,1.0)"
        			},100);
    				
    			},300)
    				
    		
    		},
    		
    		anmiClose:function(){
    			var _t = this;
    			var content = $(".BoxContent");
    			content.animate({
    				"-webkit-transform":"scale(0,0)",
    				"opacity":0
    			},300,"ease-in-out");
    			
    			setTimeout(function(){
    				content.remove();
    				a.id.remove();
    			},300)
    		},
    		
    		_bindEvent:function(){
    			o.bindEvent();
    			var close =  $(".BoxClose");
    			var bg = $(".BoxBg");
    			var _t = this;
    			require(["js/mCommon.js"], function(common){  
    				close.live(common.getEvent[0],function(){
    		    		$(this).addClass("on-120");
    		    	});
    				close.live(common.getEvent[1],function(){
    		    		$(this).removeClass("on-120");
    		    		_t.anmiClose();
    		    	});
    				if(o.clickOther){
    					
    				}
    				
    			});
    		}
			
			
	}
	
	a.init();
}




/*从上往下弹出人物框*/
$.fn.boxPeople = function( options ){ 
    var o = $.extend({ 
    		id:"boxPeople",
            headerHtml:"",
			buttonHtml:"",
			contentHtml:"",
			yesId:"",
			noId:"",
			yesFun:function(c){},
			noFun:function(){a.anmiClose();}
			
		}, options);
	
	var t = this;
	var c=options.yesFun;
	o.yesFun=function(){
		c(a.anmiClose);
	}
	
	var a = {
			init:function(){
				if($("#"+o.id).length !== 0){
					$("#"+o.id).remove();
				}
				this._createBox();
				this.setBox();
				this._bindEvent();
			},
			
			_createBox:function(){
				var html="<div  id='"+o.id+"' class='boxPeople'>" +
								"<div  class='boxPeopleBg'></div>" +
								"<div class='boxPeopleContent'>"+
									"<header>"+o.headerHtml+"</header>"+
									"<section>"+o.contentHtml+"</section>"+
									"<footer>"+o.buttonHtml+"</footer>"+
								"</div>"+
							"</div>";
						
				$("#scene").append(html);
				
			},
			
			setBox:function(){
				var _t =this;
				setTimeout(function(){
					_t.animShow();
				},100)
			},
			
			
			animShow:function(){
    			var _t = this;
    			var content = $(".boxPeople");
    			
    			content.show().css({
    				 "-webkit-transform":"translate(0,0px)"
    			});
    			
    		
    			
    			content.animate({
    				 "-webkit-transform":"translate(0,-150px)"
    			},300,"ease-in-out");
    			
    			setTimeout(function(){
    				content.animate({
    					 "-webkit-transform":"translate(0,-130px)"
        			},100);
    			},300)
    		
    		},
    		
    		anmiClose:function(){
    			var _t = this;
    			var content = $(".boxPeople");
    			content.animate({
    				 "-webkit-transform":"translate(0,0px)"
    			},300,"ease-in-out");
    			
    			setTimeout(function(){
    				content.remove();
    			},300)
    		},
    		
    		_bindEvent:function(){
    			var yes = $("#"+o.yesId);
    			var no = $("#"+o.noId);
    			require(["js/mCommon.js"], function(common){  
    				
    				yes.live(common.getEvent[1],function(){
    		    		o.yesFun();
    		    	});
    				
    				no.live(common.getEvent[1],function(){
    		    		o.noFun();
    		    	});
    				
    				$("body").live(common.getEvent[1],function(){
    		    		o.noFun();
    		    	});
    				
    			});
    		}
			
			
	}
	
	a.init();
}



/*弹出层*/
$.fn.alert = function( options ){ 
    var o = $.extend({ 
    		"width":"30%",
    		"content":"",
    		"closeTime":3000
			}, options);
    
    var a = {
    		init:function(){
    			clearTimeout($.fn.alert.timer||0);
    			this.creatHtml();
    		},
    		
    		/*创建HTML*/
    		creatHtml:function(){
    			if($(".alertClass") !== 0){
    				$(".alertClass").remove();
    			}
    			var html = "<div class='alertClass'>"+o.content+"</div>";
    			$("body").append(html);
    			this.target = $(".alertClass");
    			this.setPost();
    			this.bindEvent();
    			
    		},
    		
    		/*定位*/
    		setPost:function(){
    			
    			this.target.css({
    				"background":"#000000",
    				"color":"#fff",
					 "width":o.width,
					 "position":"absolute",
					 "zIndex":"101",
					 "border-radius":"10px",
					 "padding":"20px",
					 "font-size":"20px",
					 "textAlign":"center"
				});
    			
    			var height = $(window).height();
    			var width = $(window).width();
    			var maskHeight = this.target.height();
    			var maskWidth = this.target.width();
    			
    			this.target.css({
      				 "left":(width-maskWidth)/2,
   					 "top":(height-maskHeight)/2
   					
   				});
    			
    			this.anim();
    			
    			
    		},
    		
    		/*事件绑定*/
    		bindEvent:function(){
    			var _t = this;
    			
    			/*如果层显示出来 就隐藏*/
    			this.target.live("click",function(){
    				_t.anmiClose();
    			})
    			
    			/*规定时间后消失*/
    			$.fn.alert.timer = setTimeout(function(){
    				_t.anmiClose();
    			},o.closeTime);
    		},
    		
    		anim:function(){
    			var _t = this;
    			this.target.css({
    				 "-webkit-transform":"scale(0,0)",
    				 "opacity":0
  				});
    			
    			this.target.animate({
    				"-webkit-transform":"scale(1.1,1.1)",
    				"opacity":0.8
    			},300,"ease-in-out");
    			
    			setTimeout(function(){
    				_t.target.animate({
        				"-webkit-transform":"scale(1.0,1.0)"
        			},100);
    			},300)
    		},
    		
    		anmiClose:function(){
    			var _t = this;
    			this.target.animate({
    				"-webkit-transform":"scale(0,0)",
    				"opacity":0
    			},300,"ease-in-out");
    			
    			setTimeout(function(){
    				_t.target.remove();
    			},300)
    		}
    }
    
    a.init();
}


/*系统级--弹出层
 * 上面文字滚动提示 */
$.fn.broadcast = function( options ){ 
    var o = $.extend({ 
    		"content":"",
    		"width":"66%",
    		"closeTime":3000	
			}, options);
    var _timer;
    
    var a = {
    		init:function(){
    			
    			this._createBox();
    			this._createTextBox();
    			
    		},
    		
    		_createBox:function(){
    			clearTimeout($.fn.broadcast._timer||0);
    			if($("#bulletinBox").length !== 0){
    				$("#bulletinBox").remove();
    			}
    			var html = "<div id='bulletinBox'></div>";
    			$("body").append(html);
    			this.box = $("#bulletinBox");
    			this.box.css({
    				"width":o.width,
    				"height":"40px",
    				"position":"absolute",
    				"z-index":1000,
    				"top":"2px",
    				"left":"17%",
    				"background":"#000",
    				"opacity":0.8,
    				"line-height":"40px",
    				"overflow":"hidden"
    				
    			});
    			
    			
    		},
    		
    		_createTextBox:function(){
    			var text = "<span class='bulletinBoxText'>"+o.content+"</span>";
    			this.box.append(text);
    			this.textBox = $(".bulletinBoxText");
    			this.textBox.css({
    				"position":"absolute",
    				"top":"0px",
    				"left":"10px",
    				"color":"#fff",
    				"line-height":"40px",
    				"white-space":"nowrap" 
    			});
    			
    			this.anmiScrollText();
    			
    		},
    		
    		anmiScrollText:function(){
    			//var left = this.textBox.css("left");
    			var pWidth = parseInt(this.box.width());
    			var width = parseInt(this.textBox.width());
    			var left = width - pWidth+10;
    			var _t = this;
    			
    			if(left<0){
    				$.fn.broadcast._timer = setTimeout(function(){
            			_t.closeBox();
            		},5000);
    				return;
    			}
    			
    			
    			
    			_t.textBox.animate({
        			"left":-left
        		},left*30);
        			
        			
    			$.fn.broadcast._timer = setTimeout(function(){
        			_t.closeBox();
        		},left*30+2000);
    				
    		},
    		
    		closeBox:function(){
    			$("#bulletinBox").remove();
    		}
    		
    }
    
    a.init();
}



/**
 * slider.js for Mobile 
 * @version 1.0.2
 * @required Zepto.js
 * @author wolfer
 */

$.fn.sliderImg = function(config) {
        config = $.extend({
            el: this,
            navBarCt: '',
            remoteUrl: '',
            cycle: true,
            autoPlay: false,
            playTime: 3000,
            leftMove: '',
            rightMove: '',
            isImgSrc:false,
            scrollWidth:'',
            imgSrc:{},
            bigImgId:'',
            hasBigImg:false,
            onchange: function() {},
            onsuccess: function() {}
        }, config || {});

      
        
         var isIphone = /i(Phone|P(o|a)d)/.test(navigator.userAgent) && !! window.ontouchstart,
            isAndroid = /Android/.test(navigator.userAgent),
            has3d = isIphone && 'WebKitCSSMatrix' in window && 'm11' in new WebKitCSSMatrix(),
            translateStart = has3d ? 'translate3d(' : 'translate(',
            translateEnd = has3d ? ',0)' : ')';
         
         var SUPPORTTOUCH = document.hasOwnProperty("ontouchstart"); 
         var eventArr = SUPPORTTOUCH?["touchstart","touchend"] : ["mousedown","mouseup"];
            
    
        //private methods
        var settings = {
            //init data
            initData: function(config) {
                var chld = config.el.children();
                this.data = {
                    _items: chld,
                    _width: config.scrollWidth || chld[0].scrollWidth,
                    _trans: config.initPos || 0,
                    _pageWith: config.pageWith || 300,
                    _config: config,
                    _navBarCt: config.navBarCt,
                    _onchange: config.onchange
                };
                console.log("3-->"+chld[0].scrollWidth);
            },
            //load data
            loader: function(config) {
                var _this = this,
                    _el = config.el,
                    _fn = function() {
                        _this.cloneItem(_el, config.cycle);
                        _this.bindEvents(_el, config);
                        _this.initData(config);
                        actions.autoMove(config);
                    };
                //ajax request    
                if(config.remoteUrl) {
                    $.ajax({
                        url: config.remoteUrl,
                        success: function(data) {
                            config.onsuccess.call(_el, data);
                            _fn();
                        }
                    });
                } else {
                    _fn();
                }
              //  console.log(settings.data._onchange);
                settings.data._onchange(config,null,settings);
            },
            //clone node
            cloneItem: function(el, cycle) {
                cycle && el.append(el.children()[0].cloneNode(true));
                el.children().css({
                    "display": 'inline-block',
                    "-webkit-perspective": 1000
                });
                el.children().eq(0).addClass("on");

            },
            //bind events
            bindEvents: function(el, config) {
                el.bind({
                    "touchstart": actions.touchstart,
                    "touchmove": actions.touchmove,
                    "touchend": actions.touchend
                });
                var _t = this;
               // $(".room_info_name").html(111);
                $(config.leftMove).bind(eventArr[0],function() {
                    actions.customMove('left');
                    _t._button = this;
                });
                $(config.rightMove).bind(eventArr[0],function() {
                    actions.customMove('right');
                    _t._button = this;
                });
                
               
            }
        };
    
        //event list
        var actions = {
            //auto play timer
            autoTimer: -1,
            touchstart: function(e) {
                clearInterval(actions.autoTimer);
                actions.startX = actions.lastX = e.touches[0].clientX;
                actions.startY = e.touches[0].clientY;
            },
            touchmove: function(e) {
                var _this = actions,
                curX = e.touches[0].clientX,
                curY = e.touches[0].clientY;
                //scroll left/right position
                if(Math.abs(curX - _this.startX) > Math.abs(curY - _this.startY)) {
                    e.preventDefault();
                    //calc current position
                    var trans = settings.data._trans + curX - _this.lastX,
                    width = settings.data._width,
                    pageWith = settings.data._pageWith;
                    _this.lastX = curX;
                    //move layer position
                    
                    if(settings.data._config.cycle) {
                        if(-trans < width) {
                            trans -= width;
                        }
                        if(-trans >= width) {
                            trans += width;
                        }
                    } else {
                        if(-trans < 0) {
                            trans = settings.data._trans;
                        } else if(-trans > width - pageWith) {
                            trans = -(width - pageWith);
                        }
                    }
                    //touchmove position without animation
                    
                    _this.transition(trans, false);
                    
                    settings.data._trans = trans;
                }
            },
            touchend: function(e) {
                var _this = actions,
                    trans = settings.data._trans,
                    width = settings.data._width,
                    gap = settings.data._pageWith,
                    ot = Math.abs((trans) % gap),
                    flag = trans > 0 ? 1 : -1;
                //move time difference
                trans = _this.lastX - _this.startX < 0 ? (trans + flag * (gap - ot)) : (trans - flag * ot);
               
                if(-trans < 0) {
                    trans = settings.data._trans;
                } else if(-trans > width - gap && !settings.data._config.cycle) {
                    trans = -(width - gap);
                }
               
                _this.transition(trans, true);
                actions.autoMove(settings.data._config);
            },
            //auto play
            autoMove: function(config) {
                if(config.autoPlay) {
                    var _this = this;
    
                    function _move() {
                        var trans = settings.data._trans;
                        var pageWith = settings.data._pageWith;
                        trans += -pageWith;
                        _this.transition(trans, true);
                    };
                    _this.autoTimer = setInterval(function() {
                        _move();
                    }, config.playTime);
                }
            },
            //transition 
            transition: function(trans, animation,pos) {
                var _this = this,
                items = settings.data._items;
                items.css({
                    "-webkit-transform": translateStart + trans + "px,0" + translateEnd,
                    "-webkit-transition": animation ? "-webkit-transform 0.2s cubic-bezier(0,0,0.25,1)" : 'none'
                });
              
                
                /*加载时换图片*/
                var n = -settings.data._trans/settings.data._pageWith;
                console.log("加载时换图片:"+n+":"+ Math.round(n));
                
                console.log(-settings.data._trans+":"+settings.data._pageWith);
                var img = $(settings.data._items).find("img").eq(n+1);
                if(img){
                    img.attr("src",img.attr("_src")||img.attr("src"));
                    
                }
                
                if(animation) {
                     _this.onchange(pos);
                    items.one('webkitTransitionEnd', function() {
                        var width = settings.data._width;
                        console.log("2---->"+width);
                        if(-trans >= width) {
                            trans += width;
                            _this.transition(trans, false);
                        }
                        settings.data._trans = trans;
                        
                    });
                }
            },
            //page change event
            onchange: function(pos) {
                var _this = actions;
                var cur = parseInt((settings.data._trans) / settings.data._pageWith);
               
                var length = settings.data._items.eq(0).find(".item").length;
                if(_this.lastX - _this.startX < 0 || config.autoPlay){
                     var n = (-cur+2)%length;
                }else{
                    if(pos==="right"){
                        var n = (-cur+2)%length;
                    }else if(pos === "left"){
                        var n = (-cur)%length;
                    }else{
                        var n = (-cur+1)%length;
                    }
                    
                }
              
               // settings.data._items.eq(0).find(".item").eq(n).addClass("itemOn").siblings().removeClass("itemOn");
              if(config.isImgSrc){
                    for(var i=0; i<2; i++){
                        
                        var item = settings.data._items.eq(i).find(".item");
                        for(var j=0; j<item.length;j++){
                            $("img",item.eq(j)).attr("src", config.imgSrc[j].un);
                        }
                        $("img",item.eq(n)).attr("src", config.imgSrc[n].on);
                        if(config.hasBigImg){
                            $("#"+config.bigImgId).attr("src", config.imgSrc[n].big); 
                        }
                       
                        item.eq(n).addClass("itemOn").siblings().removeClass("itemOn");
                    }
              }
                
              settings.data._onchange(this,n,settings);
            },
            //custom move page
            customMove: function(pos) {
                clearInterval(actions.autoTimer);
                var width = settings.data._width,
                pageWith = settings.data._pageWith,
                trans = settings.data._trans + (pos == 'left' ? 1 : -1) * pageWith;
                console.log("0----------->"+settings.data._trans);
                if(!settings.data._config.cycle){
                    if(trans > 0 || -trans > width - pageWith) return;
                }else{
                	
                    if(trans > 0) {
                        this.transition(settings.data._trans = -width, false);
                        trans = -width + pageWith;
                    }   
                }
                //fixed the animation bug
                setTimeout(function(){actions.transition(trans, true,pos);},0)
                actions.autoMove(settings.data._config);
            }
        };
        
        
        settings.loader(config);
        return this;
    };

    /*圆圈滚动*/
    $.fn.circleScroll = function( options ){ 
        var o = $.extend({ 
        		"angle":72,
        		"angleMax":7,
        		"d":0,
        		"next":"",
        		"prev":"",
        		"onchange":function(){}
                }, options);
    	
    	var t = this;
    	
    	var a = {
    			init:function(){
    				this._angle = o.d*o.angle
    				this.setStyle(this._angle);
    				this._pro();
    				this._bingEvent();
    				console.log(Math.tan(0.5))
    			},

    			setStyle:function(a){
    				$(t).css({
    					 "-webkit-transform":"rotate("+a+"deg)"
    				})
    			},

    			_pro:function(){
    				var l = parseInt($(t).css("left"));
    				var a = parseInt($(t).css("top"));
    				var w = $(t).width();
    				this._o = [l+w/2,a+w/2];
    				this._now = o.d;
    			},

    			_bingEvent:function(){
    				var startX,startY,isMove,moveX,moveY,startAngle,moveAngle,endX,endY,endAngle;
    				var _t = this,next = o.next,prev = o.prev;
    				
    				require(["js/mCommon.js"], function(common){  
    				
	    				$(t).live(common.getEvent[0],function(e){
	    					startX = common.isTouch? e.touches[0].clientX: e.pageX;
	    					startY = common.isTouch? e.touches[0].clientY: e.pageY;
	    					isMove = true;
	    					startAngle = _t._getAngle(startX,startY);
	    				});
	
	    				$(t).live(common.getEvent[2],common.throttle(function(e){
	    					if(isMove){
	    						e.stopPropagation();
	    						e.preventDefault();
	    						 moveX = common.isTouch? e.changedTouches[0].clientX: e.pageX;
	    						 moveY = common.isTouch? e.changedTouches[0].clientY: e.pageY;
	    						// o.next.html("移动-->:"+ (moveY-startY)+"原始值：-->"+(moveX-startX)+"偏移量：-->"+(Math.abs(moveY-startY)<Math.abs(moveX-startX)));
	    						 if(Math.abs(moveY-startY)<Math.abs(moveX-startX)){
	    							 moveAngle = _t._getAngle(moveX,startY);
	    							 var angle = _t._angle + startAngle - moveAngle;
	    							 _t.setStyle(angle);
	    						 }
	    						//console.log("移动-->:"+ moveAngle+"原始值：-->"+startAngle+"偏移量：-->"+angle);
	    					}
	    				}, 20,50));
	    					
	
	    				
	    				$(t).live(common.getEvent[1],function(e){
	    					isMove = false;
	    					endX = common.isTouch? e.changedTouches[0].clientX: e.pageX;
	    					endY = common.isTouch? e.changedTouches[0].clientY: e.pageY;
	    					endAngle = _t._getAngle(endX,startY);
	    					var angle = startAngle-endAngle;
	    					if(Math.abs(endY-startY)<Math.abs(endX-startX)){
	    						if(Math.abs(angle)>10){
	    							var a = _t._getEndAngle(angle);
	    							_t._anmiStyle(a);
	    						}else{
	    							var a = _t._getEndAngle(0);
	    							_t._anmiStyle(a);
	    						}
	    					}else{console.log(_t._angle);	
	    						var a = _t._getEndAngle(0);
	    						_t._anmiStyle(a);
	    					}
	    					
	    				});
	    				
	    				$("body").live("touchmove",function(e){
	    					e.preventDefault();
	    					e.stopPropagation();
	    				});
	    				
	    				next.live(common.getEvent[0],function(){
	    					$(this).addClass("on");
	    				});
	    				next.live(common.getEvent[1],function(){
	    					$(this).removeClass("on");
	    					var a = _t._getEndAngle(1);
    						_t._anmiStyle(a);
	    				});
	    				
	    				prev.live(common.getEvent[0],function(){
	    					$(this).addClass("on");
	    				});
	    				prev.live(common.getEvent[1],function(){
	    					$(this).removeClass("on");
	    					var a = _t._getEndAngle(-1);
    						_t._anmiStyle(a);
	    				});
    				});
    			},

    			_getAngle:function(x,y){
    				var x = x-this._o[0];
    				var y = y-this._o[1];
    				return	90+Math.atan(x/y)*180/Math.PI;
    			},

    			_getEndAngle:function(a){
    				var _t = this;
    				if(a<0){
    					_t._angle -=  o.angle;
    					_t._angleMax = -o.angleMax;
    				}else if(a==0){
    					_t._angleMax = 0;
    				}else{
    					_t._angle +=  o.angle;
    					_t._angleMax = o.angleMax;
    				}
    				return _t._angle;
    			},

    			_anmiStyle:function(a){
    				var _t = this;
    				 $(t).css({
                        "-webkit-transform": "rotate("+(a+_t._angleMax)+"deg)",
                        "-webkit-transition": "-webkit-transform 0.4s ease-in-out"
                    });
    				 
    				 setTimeout(function(){
    					 $(t).css({
    	                        "-webkit-transform": "rotate("+(a-(_t._angleMax/2))+"deg)",
    	                        "-webkit-transition": "-webkit-transform 0.15s linear"
    	                 }); 
    					 setTimeout(function(){
        					 $(t).css({
        	                        "-webkit-transform": "rotate("+(a+(_t._angleMax/4))+"deg)",
        	                        "-webkit-transition": "-webkit-transform 0.12s linear"
        	                 }); 
        					 setTimeout(function(){
            					 $(t).css({
            	                        "-webkit-transform": "rotate("+(a)+"deg)",
            	                        "-webkit-transition": "-webkit-transform 0.05s linear"
            	                 }); 
            				 },120);
        				},150);
    				},400);
    				 o.onchange(a);

    			}
    			
    			
    			
    	}
    	
    	a.init();
    };


    /*随机显示星星动画*/
    $.fn.randomShowStar = function( options ){ 
        var o = $.extend({ 
        		num:10,
        		time:2000
            }, options);
    	
    	var t = this;
    	
    	var a = {
    			init:function(){
    				this.createStar()
    			},
    			
    			createStar:function(){
    				
    				var imgArr = [];
    				for(var i=0; i<o.num; i++){
    					imgArr.push("<img  src='images/randomStar.png' style='position:absolute;'  />")
    				}
    				$(t).html(imgArr.join(""));
    				var _t = this;
    				setInterval(function(){
    					_t.setPost();
    				},12000);
    				this.setPost();
    			},
    			
    			setPost:function(){
    				var w =26;
    				var img = $(t).find("img");
    				var animClass = [2,3,4,6];
    				for(var i=0; i<o.num; i++){
    					var y = function(n){
    						var l = parseInt(Math.random()*30)*w;
            				var t = parseInt(Math.random()*20)*w;
            				var c = Math.floor(Math.random()*animClass.length)
            				img.eq(n).css({
            					left:l,
            					top:t
            				}).addClass("randomStarAnmi_"+animClass[c]);
            			}(i)
    				}
    			}
    			
    	}
    	
    	a.init();
    }



;(function(){
	//共用基础类
	var G={
		getBaseURL:function(){
			var pathName = window.location.pathname,
				projectName = pathName.substring(0,pathName.substr(1).indexOf('/')+1);
			return "http://"+window.location.host + projectName;		
		},
		ajax:function(opt){
			var _opt=$.extend({dataType:"string",type:"get"},opt),
				url=_opt.url;
			var bu=G.getBaseURL();
			//默认给url加上当前工程的前辍
			if(url.substring(0,bu.length)!=bu){
				url=bu+url;
			}
			if(url.indexOf("?")>-1){
				url+="&"+(new Date()).getTime();
			}else{
				url+="?"+(new Date()).getTime();
			}
			
			return $.ajax({
				url:url,
				dataType:_opt.dataType,
				success:_opt.success,
				type:_opt.type,
				error:_opt.error
			})
		}
	}
	window.Game=G;
})();
(function() {
	/**
	 * 队列<br/> demo: var queue=new Queue();
	 */
	function Queue() {
		var me = this, queue = [], callback, // 回调函数
		dealFlag = !0;// 处理标记
		me.pop = function() {
			return queue.shift();
		}
		me.push = function(val) {
			queue.push(val);
		}
		/** 通知开始处理 */
		me.notify = function() {
			me.dealSyn(callback);
		}
		/**
		 * 同步处理<br/> dealFun:处理方法
		 */
		me.dealSyn = function(dealFun) {
			if (dealFlag == !0 && dealFun) {
				callback = dealFun;
				dealFlag = !1;
				deal(callback);
				dealFlag = !0;
			}
		}
		function toInt(val) {
			try {
				return parseInt(val);
			} catch (e) {
				return 3000;
			}
		}
		function deal(dealFun) {
			var item;
			while ((item = me.pop())) {
				try {
					dealFun(item);
				} catch (e) {
					console.log(e.name + ":" + e.message);
				}
			}
		}
	}
	window.Queue = Queue;
	
	var button = $(".pokeyButton");
	require(["js/mCommon.js"], function(common){  
		
		button.live(common.getEvent[0],function(){
    		$(this).addClass("buttonClick");
    	});
		button.live(common.getEvent[1],function(){
    		$(this).removeClass("buttonClick");
    	});
		
    	
	});
	
	
	
	
})();
/*
 * (function(){ function test(){ var queue=new Queue(); queue.push(1);
 * queue.push(2); queue.push(3); var i=6,j=1005; queue.dealSyn(function(v){
 * console.log(v); }) setInterval(function(){ if(i<j){ queue.push(i++);
 * queue.notify(); } },100) setInterval(function(){ if(j<3000){
 * queue.push(j++); queue.notify(); } },100) } test(); })();
 */

